# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=cl-clx
_pkgname="${pkgname#cl-}"
pkgver=0.7.5.r71.gf5bc0ab
pkgrel=1
pkgdesc='An implementation of the X Window System protocol in Common Lisp'
arch=('any')
url='https://github.com/sharplispers/clx'
license=('custom')
depends=(
  'common-lisp'
  'cl-asdf'
  'xorg-server'
)
makedepends=('git')
_commit='f5bc0abbe45e75273186ebb46b6d0babe31c8724'
source=(
  "$pkgname::git+$url#commit=$_commit"
  'LICENSE'
)
b2sums=('SKIP'
        '34618719b2c0a4407b8f83d5ff0e4599337e4bfd5e207563b22ee657b8a04f8e7e384aebe72f1406cf084d9657e0af394175386a1511a304db86b08f4abedd1a')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed -e 's/^v//' -e 's/-/.r/' -e 's/-/./g'
}

build() {
  cd "$pkgname/manual"

  makeinfo clx.texinfo
}

package() {
  cd "$pkgname"

  # library
  install -vd "$pkgdir/usr/share/common-lisp/source/$_pkgname"
  cp -vr \
    debug demo extensions tests ./*.{lisp,asd} \
    "$pkgdir/usr/share/common-lisp/source/$_pkgname"

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md 
  install -vDm644 -t "$pkgdir/usr/share/info" manual/clx.info

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" ../LICENSE
}
